package edu.usc.cmb.iregulome.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/*DROP TABLE IF EXISTS `SAMPLE_TABLE`;
 CREATE TABLE `SAMPLE_TABLE` (
 -- `SAMPLE_ID` int(4) unsigned NOT NULL AUTO_INCREMENT, -- AUTO INCREMENT
 `SAMPLE_ID` varchar(10) NOT NULL default '', -- \SAMPLE\@accession
 `F_STUDY_ID` varchar(10) NOT NULL default '',
 `SAMPLE_REF_NAME` varchar(200) NOT NULL default '', -- \SAMPLE\@alias
 `INSTRUMENT_MODEL` varchar(200) NOT NULL default '', -- \EXPERIMENT\PLATFORM\ILLUMINA\INSTRUMENT_MODEL
 `AXION` int(8) NOT NULL, -- \SAMPLE\SAMPLE_NAME\TAXON_ID
 `DESCRIPTION` varchar(5000) NOT NULL default '', -- \SAMPLE\DESCRIPTION
 `URL` varchar(200) NOT NULL default '',
 PRIMARY KEY (`SAMPLE_ID`)
 ) ENGINE=INNODB CHARSET=latin1;*/

@Entity
@Table(name = "SAMPLE_TABLE")
public class Sample {

	@Id
	@Column(name = "SAMPLE_ID")
	private String id;

	@Column(name = "SAMPLE_REF_NAME")
	private String alias;

	@Column(name = "INSTRUMENT_MODEL")
	private String instrumentModel;

	@Column(name = "TAXON_ID")
	private int taxonid;

	@Column(name = "DESCRIPTION")
	private String description;

	@Column(name = "URL")
	private String url;

	@Column(name = "DOWNLOAD_FLAG")
	private boolean downloadFlag;

	@Column(name = "CELL_TYPE")
	private String cellType;

	public String getCellType() {
		return cellType;
	}

	public void setCellType(String cellType) {
		this.cellType = cellType;
	}

	public String getFactor() {
		return factor;
	}

	public void setFactor(String factor) {
		this.factor = factor;
	}

	@Column(name = "FACTOR")
	private String factor;

	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST,
			CascadeType.ALL })
	@JoinColumn(name = "F_STUDY_ID")
	private Study study;

	@OneToMany(cascade = { CascadeType.ALL })
	@JoinColumn(name = "F_SAMPLE_ID")
	private List<SampleAttribute> sampleAttributes;

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public String getInstrumentModel() {
		return instrumentModel;
	}

	public void setInstrumentModel(String instrumentModel) {
		this.instrumentModel = instrumentModel;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setStudy(Study study) {
		this.study = study;
	}

	public Study getStudy() {
		return study;
	}

	public void setTaxonid(int taxonid) {
		this.taxonid = taxonid;
	}

	public int getTaxonid() {
		return taxonid;
	}

	public void setDownloadFlag(boolean downloadFlag) {
		this.downloadFlag = downloadFlag;
	}

	public boolean isDownloadFlag() {
		return downloadFlag;
	}

	public void setSampleAttributes(List<SampleAttribute> sampleAttributes) {
		this.sampleAttributes = sampleAttributes;
	}

	public List<SampleAttribute> getSampleAttributes() {
		return sampleAttributes;
	}

}
